import Request from '@/utils/request'

const baseUrl = process.env.VUE_APP_BASE_FRONT_API_URL

export const frontRequest = new Request(baseUrl)

export const userLogin = (data: any) => {
  return frontRequest.request({
    method: 'post',
    url: '/user/login',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data
  })
}

export const getUserInfo = () => {
  return frontRequest.request({
    method: 'get',
    url: '/user/getInfo'
  })
}

export const refreshToken = (data: any) => {
  return frontRequest.request({
    method: 'post',
    url: '/user/refresh_token',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data
  })
}
